<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<%@ page import="java.util.*"  %>
    
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>

<% Calendar ctoday = Calendar.getInstance(); %>
<h2><%=ctoday.get(Calendar.YEAR)%></h2>
<%
    Calendar cfirstday = Calendar.getInstance();
    Calendar clastday = Calendar.getInstance();

%>
<style>
td{font:10px Arial Narrow; text-align:right }
</style>
<% 

for (int i=0;i<12;i++) {
    cfirstday.set(ctoday.get(Calendar.YEAR), i, 1);
    clastday.set(ctoday.get(Calendar.YEAR),i+1, 1);

%>
<table>
    <tr>
    <th colspan="7" bgcolor="#D0D0D0">
<%=cfirstday.getTime().getMonth()+1%>    
    </th>
    </tr>

<%

String span = "";
String day = "";
        span=" colspan=\""+cfirstday.get(Calendar.DAY_OF_WEEK)+"\"";
while(cfirstday.before(clastday)) {

    day = ""+cfirstday.get(Calendar.DATE);
    if(ctoday.equals(cfirstday)) 
        day= "<font color=\"#8080FF\">"+day+"</font>";
%>
    <td<%=span%>>
        <%=day %><br>
    </td>
<%

    if ( cfirstday.get(Calendar.DAY_OF_WEEK)%7==0) 
    { %>
    </tr>
    <tr>
<%
    } 
    span="";
    cfirstday.add(Calendar.DATE, 1);
}
%>
    </tr>
</table>

<%
}
%>
